[IA64] Steal time accounting for PV domain - hypervisor side
authorawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Wed, 7 Mar 2007 20:16:07 +0000 (13:16 -0700)
committerawilliam@xenbuild2.aw <awilliam@xenbuild2.aw>
Wed, 7 Mar 2007 20:16:07 +0000 (13:16 -0700)
Signed-off-by: Atsushi SAKAI <sakaia@jp.fujitsu.com>
xen/arch/ia64/linux-xen/entry.S
xen/arch/ia64/xen/domain.c
xen/include/asm-ia64/hypercall.h

index 0f6aaf80d78716eaddd5b7ef38dcdeb4cf6bc70c..9f008c684150029daf62fc65d98e5e011049618f 100644 (file)
@@ -1509,7 +1509,7 @@ ia64_hypercall_table:
        data8 do_ni_hypercall           /* do_vm_assist */
        data8 do_ni_hypercall           /* do_update_va_mapping_othe */
        data8 do_ni_hypercall           /* (x86 only) */
-       data8 do_ni_hypercall           /* do_vcpu_op */
+       data8 do_vcpu_op                /* do_vcpu_op */
        data8 do_ni_hypercall           /* (x86_64 only) */    /* 25 */
        data8 do_ni_hypercall           /* do_mmuext_op */
        data8 do_ni_hypercall           /* do_acm_op */
index 631d8dfa094f724d48c902f25ab1452a05fe30a7..bf063895b5d45de0c586dc697bd2e4bc107278ab 100644 (file)
@@ -50,6 +50,7 @@
 #include <xen/guest_access.h>
 #include <asm/tlb_track.h>
 #include <asm/perfmon.h>
+#include <public/vcpu.h>
 
 unsigned long dom0_size = 512*1024*1024;
 
@@ -262,6 +263,9 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
                 vcpu_info[current->vcpu_id].evtchn_upcall_mask;
             __ia64_per_cpu_var(current_psr_ic_addr) =
                 (int *)(nd->arch.shared_info_va + XSI_PSR_IC_OFS);
+            /* steal time accounting */
+            if (!guest_handle_is_null(runstate_guest(current)))
+                __copy_to_guest(runstate_guest(current), &current->runstate, 1);
         } else {
             /* When switching to idle domain, only need to disable vhpt
              * walker. Then all accesses happen within idle context will
@@ -1257,6 +1261,45 @@ void sync_vcpu_execstate(struct vcpu *v)
        // FIXME SMP: Anything else needed here for SMP?
 }
 
+/* This function is taken from xen/arch/x86/domain.c */
+long
+arch_do_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg)
+{
+       long rc = 0;
+
+       switch (cmd) {
+       case VCPUOP_register_runstate_memory_area:
+       {
+               struct vcpu_register_runstate_memory_area area;
+               struct vcpu_runstate_info runstate;
+
+               rc = -EFAULT;
+               if (copy_from_guest(&area, arg, 1))
+                       break;
+
+               if (!guest_handle_okay(area.addr.h, 1))
+                       break;
+
+               rc = 0;
+               runstate_guest(v) = area.addr.h;
+
+               if (v == current) {
+                       __copy_to_guest(runstate_guest(v), &v->runstate, 1);
+               } else {
+                       vcpu_runstate_get(v, &runstate);
+                       __copy_to_guest(runstate_guest(v), &runstate, 1);
+               }
+
+               break;
+       }
+       default:
+               rc = -ENOSYS;
+               break;
+       }
+
+       return rc;
+}
+
 static void parse_dom0_mem(char *s)
 {
        dom0_size = parse_size_and_unit(s, NULL);
index ed0af4678db9a6272e0f1d5f4fb1cd64bf91a2ee..0af7ebcee57f2d10a410044b3ff58b249e5ac462 100644 (file)
@@ -22,6 +22,7 @@ vmx_do_mmu_update(
     u64 *pdone,
     u64 foreigndom);
 
-#define arch_do_vcpu_op(cmd, vcpu, arg) (-ENOSYS)
+extern long
+arch_do_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg);
 
 #endif /* __ASM_IA64_HYPERCALL_H__ */